﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VisitorPattern.Samples;

internal class Document
{
    private readonly List<IDocumentElement> _documentElements = new();

    public void AddElement(IDocumentElement element) => _documentElements.Add(element);

    public void Accept(IVisitorSample visitor)
    {
        foreach (IDocumentElement element in _documentElements)
        {
            element.Accept(visitor);
        }
    }
}
